#include <stdio.h>
int main()
{
    int a,n,t,d,e,f,g,h,i;
    while (scanf("%d",&n)!=EOF)
    {
        if (n==0)break;
        t=0;
        while (n--)
        {
            scanf("%d",&a);
            d=a/100;
            a-=d*100;
            e=a%100/50;
            a-=e*50;
            f=a%50/10;
            a-=f*10;
            g=a%10/5;
            a-=g*5;
            h=a%5/2;
            a-=h*2;
            i=a%2;
            t+=d+e+f+g+h+i;
        }
        printf("%d\n",t);
    }
    return 0;
}